$(document).ready(function() {			  
	// Switch categories
		$('#h-wrap').hover(function(){
				$(this).toggleClass('active');
				$("#h-wrap ul").css('display', 'block');
			}, function(){
				$(this).toggleClass('active');
				$("#h-wrap ul").css('display', 'none');
		});
	// Handling with tables (adding first and last classes for borders and adding alternate bgs)
		$('tbody tr:even').addClass('even');
		$('table.grid tbody tr:last-child').addClass('last');
		$('tr th:first-child, tr td:first-child').addClass('first');
		$('tr th:last-child, tr td:last-child').addClass('last');
		$('form.fields fieldset:last-child').addClass('last');
	// Handling with lists (alternate bgs)
		$('ul.simple li:even').addClass('even');
	// Handling with grid views (adding first and last classes for borders and adding alternate bgs)
		$('.grid .line:even').addClass('even');
		$('.grid .line:first-child').addClass('firstline');
		$('.grid .line:last-child').addClass('lastline');
	// Tabs switching
		$('#box1 .content#box1-grid').hide(); // hide content related to inactive tab by default
		$('#box1 .header ul a').click(function(){
			$('#box1 .header ul a').removeClass('active');
			$(this).addClass('active'); // make clicked tab active
			$('#box1 .content').hide(); // hide all content
			$('#box1').find('#' + $(this).attr('rel')).show(); // and show content related to clicked tab
			return false;
		});
});